<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>序列化框架深入分析 | Hexo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="序列化　　把对象转换为字节序列的过程称为对象的序列化，把字节序列恢复为对象的过程称为对象的反序列化。对象的序列化主要有两种用途：1. 把对象的字节序列永久地保存到硬盘上，通常存放在一个文件中；2. 在网络上传送对象的字节序列。　　在java的生态体系统中，我们可以找到很多不同的序列化产品，他们各有优缺点，下面我就从序列化速度和序列化后字节大小两个方面分析一下知名的序列化框架，比如：protobuf">
<meta property="og:type" content="article">
<meta property="og:title" content="序列化框架深入分析">
<meta property="og:url" content="http://yoursite.com/2016/01/17/java/10.序列化框架深入分析/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="序列化　　把对象转换为字节序列的过程称为对象的序列化，把字节序列恢复为对象的过程称为对象的反序列化。对象的序列化主要有两种用途：1. 把对象的字节序列永久地保存到硬盘上，通常存放在一个文件中；2. 在网络上传送对象的字节序列。　　在java的生态体系统中，我们可以找到很多不同的序列化产品，他们各有优缺点，下面我就从序列化速度和序列化后字节大小两个方面分析一下知名的序列化框架，比如：protobuf">
<meta property="og:image" content="http://yoursite.com/images/tlv-tag.png">
<meta property="og:image" content="http://yoursite.com/images/tlv-tag2.png">
<meta property="og:updated_time" content="2016-01-29T17:47:36.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="序列化框架深入分析">
<meta name="twitter:description" content="序列化　　把对象转换为字节序列的过程称为对象的序列化，把字节序列恢复为对象的过程称为对象的反序列化。对象的序列化主要有两种用途：1. 把对象的字节序列永久地保存到硬盘上，通常存放在一个文件中；2. 在网络上传送对象的字节序列。　　在java的生态体系统中，我们可以找到很多不同的序列化产品，他们各有优缺点，下面我就从序列化速度和序列化后字节大小两个方面分析一下知名的序列化框架，比如：protobuf">
  
    <link rel="alternative" href="/atom.xml" title="Hexo" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  <link rel="stylesheet" href="/css/style.css" type="text/css">
  

</head>
<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Hexo</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-java/10.序列化框架深入分析" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2016/01/17/java/10.序列化框架深入分析/" class="article-date">
  <time datetime="2016-01-17T06:08:00.000Z" itemprop="datePublished">2016-01-17</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/java/">java</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      序列化框架深入分析
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="u5E8F_u5217_u5316"><a href="#u5E8F_u5217_u5316" class="headerlink" title="序列化"></a>序列化</h2><p>　　把对象转换为字节序列的过程称为对象的序列化，把字节序列恢复为对象的过程称为对象的反序列化。对象的序列化主要有两种用途：1. 把对象的字节序列永久地保存到硬盘上，通常存放在一个文件中；2. 在网络上传送对象的字节序列。<br>　　在java的生态体系统中，我们可以找到很多不同的序列化产品，他们各有优缺点，下面我就从序列化速度和序列化后字节大小两个方面分析一下知名的序列化框架，比如：protobuf、thrift、avro、kyro、messagePack和jdk的Serializable接口，在最后，我们会实现一个简单的二进制编解码功能，完整的测试代码详见文章最后附件。<br>　　本文不会涉及到各序列化框架的基础部分，如果需要请自行查找资料！这里先贴出测试结果：可以看到protobuf无论是在速度还是序列化大小方面几乎都是最好的，非常适合于即使通信领域的数据协议交换格式！</p>
<table>
<thead>
<tr>
<th style="text-align:center">框架</th>
<th style="text-align:center">协议</th>
<th style="text-align:center">大小(字节)</th>
<th style="text-align:center">序列化<br>500w次(毫秒)</th>
<th>反序列化<br>500w次(毫秒)</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">jdk</td>
<td style="text-align:center">—</td>
<td style="text-align:center">115</td>
<td style="text-align:center">8234毫秒</td>
</tr>
<tr>
<td style="text-align:center">protobuf</td>
<td style="text-align:center">—</td>
<td style="text-align:center">16</td>
<td style="text-align:center">243毫秒</td>
</tr>
<tr>
<td style="text-align:center">thrift</td>
<td style="text-align:center">TBinaryProtocol</td>
<td style="text-align:center">27</td>
<td style="text-align:center">1544毫秒</td>
</tr>
<tr>
<td style="text-align:center">thrift</td>
<td style="text-align:center">TCompactProtocol</td>
<td style="text-align:center">17</td>
<td style="text-align:center">1345毫秒</td>
</tr>
<tr>
<td style="text-align:center">thrift</td>
<td style="text-align:center">TTupleProtocol</td>
<td style="text-align:center">15</td>
<td style="text-align:center">1102毫秒</td>
</tr>
<tr>
<td style="text-align:center">messagePack</td>
<td style="text-align:center">—</td>
<td style="text-align:center">15</td>
<td style="text-align:center">5846毫秒</td>
</tr>
<tr>
<td style="text-align:center">avro</td>
<td style="text-align:center">SpecificDatumWriter</td>
<td style="text-align:center">17</td>
<td style="text-align:center">6215毫秒</td>
</tr>
<tr>
<td style="text-align:center">avro</td>
<td style="text-align:center">ReflectDatumWriter</td>
<td style="text-align:center">17</td>
<td style="text-align:center">6660毫秒</td>
</tr>
<tr>
<td style="text-align:center">kyro</td>
<td style="text-align:center">writeClassAndObject</td>
<td style="text-align:center">16</td>
<td style="text-align:center">4748毫秒</td>
</tr>
<tr>
<td style="text-align:center">kyro</td>
<td style="text-align:center">writeObject</td>
<td style="text-align:center">15</td>
<td style="text-align:center">4929毫秒</td>
</tr>
<tr>
<td style="text-align:center">kyro</td>
<td style="text-align:center">writeClassAndObject</td>
<td style="text-align:center">16</td>
<td style="text-align:center">4832毫秒</td>
</tr>
<tr>
<td style="text-align:center">kyro</td>
<td style="text-align:center">writeObject</td>
<td style="text-align:center">15</td>
<td style="text-align:center">4897毫秒</td>
</tr>
</tbody>
</table>
<h2 id="jdk_u5E8F_u5217_u5316"><a href="#jdk_u5E8F_u5217_u5316" class="headerlink" title="jdk序列化"></a>jdk序列化</h2><p>　　Java的序列化算法一般会按步骤做如下事情：<br>　　1. 将对象实例相关的类元数据输出，包括：类名、字段类型（比如java.lang.Strng）、名称和serialVersionID等信息。<br>　　2. 递归地输出类的超类描述直到不再有超类。<br>　　3. 类元数据完了以后，开始从最顶层的超类开始输出对象实例的实际数据值。<br>　　4. 从上至下递归输出实例的数据<br>　　从上面的步骤可以看出，采用jdk序列化得到的二进制数据含有大量的元数据信息，这样可以很好的保证其兼容性的问题。但是在特定的应用场景下，特别是移动网路中，考虑到网络稳定性和流量消耗的问题，我们更关注的是数据传输时的大小和编解码的效率，而协议的兼容性问题可以通过其他的方式解决！在介绍protobuf、thrift等实现原理之前，我们先看看tlv（tag length value）思想！</p>
<h2 id="TLV"><a href="#TLV" class="headerlink" title="TLV"></a>TLV</h2><p>　　TLV即Tag-Length-Value，可以看到，TLV的定义包括三个域，分别为：标签域（Tag）、长度域（Length）和内容域（Value）。这里的长度域的值实际上就是内容域的长度。同时，其编码方式有两种情况，一种是确定长度的方式，一种是不确定长度的方式，而金融TLV选择了确定长度的方式。这里我们先解释一下这几个域的数据结构：<br>　　<strong>Tag域</strong>：TLV的Tag是如何编码的，先看下图：<img src="/images/tlv-tag.png" alt="tlv-tag.png"><br>　　说明了Tag域第一个字节的编码格式。其中b8-b1代表1个字节中的8个位。其中b8，b7代表数据的类别。根据2个位的组合，有四种类别：通用类别、应用类别、上下文语境类别和专用类别。这个主要用于在于终端设备交互的时候，确定数据处理的类型。<strong>b6代表的是数据元结构，也就是说它是属于简单数据元结构，还是属于结构（复合）数据元结构</strong>。当b6为1的时候，就需要后续的字节进行扩展。也就是说复合的TLV中，value域里也包含一个或多个TLV，这个稍后接着介绍。<br>　　当b5-b1代表串行号，当5个位都为1时，需要将tag域扩展到下一个字节中，也就是Tag占2个字节；而当5个位都不全为1时，该Tag域就只占1个字节。现在，看下b5-b1：11111的情况：<img src="/images/tlv-tag2.png" alt="tlv-tag2.png"><br>　　从图中我们看到BER-TLV编码中，当b8为1时，Tag还需要有后续字节，直到b8为0为止。从EMV文档中的说明，Tag最多只占用2个字节，所以这样就相对比较简单一些了。当b8为0时，该Tag域结束，总共就占用2个字节。<br>　　<strong>Length域</strong>：默认一个字节长度，当b8（最高位）为0时，该字节的b7-b1作为value域的长度；当b8为1时，b7-b1作为后续字节的长度，也就是说，例如有这样一个值：10000011，代表后续还有3个字节作为value域的长度（本字节不算，本字节变为作为一个Length的索引）。<br>　　<strong>Value域</strong>：这里需要分成两种情况考虑，如果value是一个简单的数据，比如int、string等，则就是实际的值。但如果value值是一个复杂的数据结构，则存储的则为TLV格式的。<br>　　下面介绍的Protobuf序列化机制就是在该机制的原理上进行了调整，实现了更高效的序列化！</p>
<h2 id="Protobuf"><a href="#Protobuf" class="headerlink" title="Protobuf"></a>Protobuf</h2><p>　　Protobuf是鼎鼎大名的Google公司开发出来，并在Google内部久经考验的一个产品。它通过自定义二进制协议的方式，实现了极致的序列化过程</p>
<h4 id="Variants"><a href="#Variants" class="headerlink" title="Variants"></a>Variants</h4><p>　　Protobuf对数据编码时，采用了一种叫做Variants的技术。顾名思义，Varints是一种紧凑表示数字的方法。它用一个或者多个字节表示一个数字，值越小的数字字节数越少。相对于传统的用4字节表示int32类型数字，Varints对于小于128的数值都可以用一个字节表示，大于128的数值会用更多的字节来表示，比如150，就会用两个字节表示。Varints算法总体来说就是，<strong>Varints中每一个字节的最高位(官方叫most significant bit，简称MSB)如果是1，则表示后续的字节也是该数字的一部分；如果是0，则结束</strong>。所以当数字为&lt;128时，比如10，则会用一个字节来表示：00001010。如果数字是150的话，则会用两个字节来表示：10010110 00000001。其详细的计算过程为：<br>　　上述最高位是MSB，表明后续的字节也属于本数值。第二个字节MSB为0，表明结束。所以去掉MSB以后为:0010110 0000001。<strong>Protobuf是小字节序</strong>，所以再反序一下变成：0000001 0010110 =&gt; 10010110，转换成10进制就是150。我们先看看下面的测试用例：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="annotation">@Test</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">protobufTest</span><span class="params">()</span> <span class="keyword">throws</span> IOException </span>&#123;</span><br><span class="line">    ProtobufMsg.Msg.Builder builder = ProtobufMsg.Msg.newBuilder();</span><br><span class="line">    builder.setType(type);</span><br><span class="line">    builder.setBody(msg);</span><br><span class="line">    ProtobufMsg.Msg deviceMsg = builder.build();</span><br><span class="line"></span><br><span class="line">    <span class="keyword">byte</span>[] bytes = deviceMsg.toByteArray();</span><br><span class="line"></span><br><span class="line">    System.out.println(<span class="string">"protobuf序列化后大小:"</span> + bytes.length);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">long</span> startTime = System.nanoTime();</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; cycleIndex; i++) &#123;</span><br><span class="line">        deviceMsg.toByteArray();</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">long</span> endTome = System.nanoTime();</span><br><span class="line">    System.out.println(String.format(<span class="string">"protobuf序列化%d次共耗时%d毫秒"</span>, cycleIndex, (endTome - startTime) / <span class="number">1000</span> / <span class="number">1000</span>));</span><br><span class="line">    System.out.println();</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>　　这里，Msg有三个字段，但是只对type(int)和body(String)两个属性设置了值。<br>　　<strong>type属性序列化的过程</strong>：<br>　　1. 首先type字段的编号在protobuf描述文件中已经定义了，取值为1。在生成的java类中则用field_number=1表示<br>　　2. 计算其Tag值，算法为：(field_number &lt;&lt; 3) | wire_type，此处wire_type的类型则为WireFormat.WIRETYPE_VARINT=0，计算出的tag结果为(1 &lt;&lt; 3) | 0 = 8<br>　　3. 由于type为基本类型，所以type序列化后的字节为8和1（无需length域指定数字占用的字节长度），共占用2个字节<br>　　<strong>body属性的序列化过程</strong>：<br>　　1. 首先body字段的编号在protobuf描述文件中已经定义了，取值为3。在生成的java类中则用field_number=3表示<br>　　2. 计算其Tag值，算法不变，只是此时wire_type取值为：WireFormat.WIRETYPE_LENGTH_DELIMITED=2，计算出的tag结果为 (3 &lt;&lt; 3) | 2 = 26<br>　　3. 由于body为字符串类型，需要length域指定值的字节长度，序列化的二进制内容为：26、12(“测试内容”的utf8编码后长度)以及测试内容，共占用14个字节<br>　　type和body序列化后的大小总共为16个byte，与日志输出一致。我们可以这样理解Tag：其低三位表示value的类型，剩下的高位表示field的真正index。<br>　　通过对序列化过程的分析，我们可以发现：<strong>protobuf序列化后的二进制数据是没有记录数据类型的</strong>，所以如果只给出protobuf序列化后的二进制数据，是无法知道其数据类型的。在大多数的应用系统中，有多种不同结构的数据，采用protobuf框架的话，就需要通过其他的手段区别不同的二进制数据类型！</p>
<h2 id="u603B_u7ED3"><a href="#u603B_u7ED3" class="headerlink" title="总结"></a>总结</h2><p>　　理解了protobuf的原理之后，其他的框架，比如thrift等的原理基本上也就明白了，这里不再做过多的介绍。核心思想基本上都是：给每一个属性编号，用数字替代其属性名（无论多长的名称通过4个byte就可以表示），再根据数字的值，由4个byte压缩成1个或多个byte，同时剔除不必要的元数据信息，达到最佳的序列化性能！<br>　　完整的示例请下载：<a href="/code/serializer-demo.zip">serializer-demo.zip</a></p>
<h2 id="u53C2_u8003_u94FE_u63A5"><a href="#u53C2_u8003_u94FE_u63A5" class="headerlink" title="参考链接"></a>参考链接</h2><p><a href="http://blog.sina.com.cn/s/blog_67d440ab0101hcqe.html" target="_blank" rel="external">http://blog.sina.com.cn/s/blog_67d440ab0101hcqe.html</a><br><a href="http://www.cnblogs.com/liping13599168/archive/2011/06/15/2081366.html" target="_blank" rel="external">http://www.cnblogs.com/liping13599168/archive/2011/06/15/2081366.html</a><br><a href="http://www.cnblogs.com/redcreen/articles/1955307.html" target="_blank" rel="external">http://www.cnblogs.com/redcreen/articles/1955307.html</a><br><a href="http://www.cnblogs.com/xdp-gacl/p/3777987.html" target="_blank" rel="external">http://www.cnblogs.com/xdp-gacl/p/3777987.html</a><br><a href="http://blog.csdn.net/ghsau/article/details/18240731" target="_blank" rel="external">http://blog.csdn.net/ghsau/article/details/18240731</a><br><a href="http://blog.csdn.net/fenglibing/article/details/6859802" target="_blank" rel="external">http://blog.csdn.net/fenglibing/article/details/6859802</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2016/01/17/java/10.序列化框架深入分析/" data-id="cijzzpveq00e11cfs3awhgcq4" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/protobuf/">protobuf</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2016/01/17/gis/4.常用资料/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          常用资料
        
      </div>
    </a>
  
  
    <a href="/2016/01/17/gis/3.SLD配置示例/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">SLD配置示例</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Categories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/cache/">cache</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/database/">database</a><span class="category-list-count">13</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/docker/">docker</a><span class="category-list-count">6</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/gis/">gis</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/git/">git</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/go/">go</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/gradle/">gradle</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/groovy/">groovy</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/hadoop/">hadoop</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/java/">java</a><span class="category-list-count">18</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/log/">log</a><span class="category-list-count">11</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/mongodb/">mongodb</a><span class="category-list-count">14</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/mq/">mq</a><span class="category-list-count">6</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/mybatis/">mybatis</a><span class="category-list-count">9</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/netty/">netty</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/nginx/">nginx</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/nio/">nio</a><span class="category-list-count">19</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/nodejs/">nodejs</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/redis/">redis</a><span class="category-list-count">6</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/rpc/">rpc</a><span class="category-list-count">14</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/spring/">spring</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/tomcat/">tomcat</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/zookeeper/">zookeeper</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/杂项/">杂项</a><span class="category-list-count">2</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/aop/">aop</a><span class="tag-list-count">8</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/aspectj/">aspectj</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cache/">cache</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/classloader/">classloader</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/common-loggings/">common-loggings</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/commonjs/">commonjs</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/database/">database</a><span class="tag-list-count">10</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/docker/">docker</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/dubbo/">dubbo</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/fastdfs/">fastdfs</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gclib/">gclib</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/geohash/">geohash</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gis/">gis</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/go/">go</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gradle/">gradle</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/groovy/">groovy</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hadoop/">hadoop</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hessisan/">hessisan</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a><span class="tag-list-count">48</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javassist/">javassist</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/kafka/">kafka</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/log/">log</a><span class="tag-list-count">11</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/log4j/">log4j</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/logback/">logback</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/map/">map</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memecached/">memecached</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mina/">mina</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mongodb/">mongodb</a><span class="tag-list-count">14</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mq/">mq</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mqtt/">mqtt</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mybatis/">mybatis</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/netty/">netty</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nginx/">nginx</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nio/">nio</a><span class="tag-list-count">5</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/nodejs/">nodejs</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/postgresql/">postgresql</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/protobuf/">protobuf</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/proxy/">proxy</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/push/">push</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rabbitmq/">rabbitmq</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/redis/">redis</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rpc/">rpc</a><span class="tag-list-count">14</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sitemesh/">sitemesh</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sld/">sld</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/slf4j/">slf4j</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/socket/">socket</a><span class="tag-list-count">7</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/spatialite-for-android/">spatialite for android</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/spi/">spi</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/spring/">spring</a><span class="tag-list-count">13</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tomcat/">tomcat</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/transaction/">transaction</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/web/">web</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/xSocket/">xSocket</a><span class="tag-list-count">7</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/zbus/">zbus</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/zookeeper/">zookeeper</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/数据结构/">数据结构</a><span class="tag-list-count">2</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/aop/" style="font-size: 15.38px;">aop</a> <a href="/tags/aspectj/" style="font-size: 11.54px;">aspectj</a> <a href="/tags/cache/" style="font-size: 11.54px;">cache</a> <a href="/tags/classloader/" style="font-size: 10px;">classloader</a> <a href="/tags/common-loggings/" style="font-size: 10px;">common-loggings</a> <a href="/tags/commonjs/" style="font-size: 12.31px;">commonjs</a> <a href="/tags/database/" style="font-size: 16.92px;">database</a> <a href="/tags/docker/" style="font-size: 13.85px;">docker</a> <a href="/tags/dubbo/" style="font-size: 10px;">dubbo</a> <a href="/tags/fastdfs/" style="font-size: 10px;">fastdfs</a> <a href="/tags/gclib/" style="font-size: 10.77px;">gclib</a> <a href="/tags/geohash/" style="font-size: 10px;">geohash</a> <a href="/tags/gis/" style="font-size: 10px;">gis</a> <a href="/tags/git/" style="font-size: 10.77px;">git</a> <a href="/tags/go/" style="font-size: 10px;">go</a> <a href="/tags/gradle/" style="font-size: 10px;">gradle</a> <a href="/tags/groovy/" style="font-size: 10px;">groovy</a> <a href="/tags/hadoop/" style="font-size: 10px;">hadoop</a> <a href="/tags/hessisan/" style="font-size: 11.54px;">hessisan</a> <a href="/tags/java/" style="font-size: 20px;">java</a> <a href="/tags/javassist/" style="font-size: 10px;">javassist</a> <a href="/tags/kafka/" style="font-size: 11.54px;">kafka</a> <a href="/tags/linux/" style="font-size: 12.31px;">linux</a> <a href="/tags/log/" style="font-size: 17.69px;">log</a> <a href="/tags/log4j/" style="font-size: 12.31px;">log4j</a> <a href="/tags/logback/" style="font-size: 13.08px;">logback</a> <a href="/tags/map/" style="font-size: 10px;">map</a> <a href="/tags/memecached/" style="font-size: 10.77px;">memecached</a> <a href="/tags/mina/" style="font-size: 13.08px;">mina</a> <a href="/tags/mongodb/" style="font-size: 19.23px;">mongodb</a> <a href="/tags/mq/" style="font-size: 13.85px;">mq</a> <a href="/tags/mqtt/" style="font-size: 10.77px;">mqtt</a> <a href="/tags/mybatis/" style="font-size: 16.15px;">mybatis</a> <a href="/tags/netty/" style="font-size: 10px;">netty</a> <a href="/tags/nginx/" style="font-size: 11.54px;">nginx</a> <a href="/tags/nio/" style="font-size: 13.08px;">nio</a> <a href="/tags/nodejs/" style="font-size: 10px;">nodejs</a> <a href="/tags/postgresql/" style="font-size: 10.77px;">postgresql</a> <a href="/tags/protobuf/" style="font-size: 10px;">protobuf</a> <a href="/tags/proxy/" style="font-size: 10px;">proxy</a> <a href="/tags/push/" style="font-size: 10px;">push</a> <a href="/tags/rabbitmq/" style="font-size: 11.54px;">rabbitmq</a> <a href="/tags/redis/" style="font-size: 13.85px;">redis</a> <a href="/tags/rpc/" style="font-size: 19.23px;">rpc</a> <a href="/tags/sitemesh/" style="font-size: 10px;">sitemesh</a> <a href="/tags/sld/" style="font-size: 10px;">sld</a> <a href="/tags/slf4j/" style="font-size: 10px;">slf4j</a> <a href="/tags/socket/" style="font-size: 14.62px;">socket</a> <a href="/tags/spatialite-for-android/" style="font-size: 10px;">spatialite for android</a> <a href="/tags/spi/" style="font-size: 10px;">spi</a> <a href="/tags/spring/" style="font-size: 18.46px;">spring</a> <a href="/tags/tomcat/" style="font-size: 10.77px;">tomcat</a> <a href="/tags/transaction/" style="font-size: 10px;">transaction</a> <a href="/tags/web/" style="font-size: 10px;">web</a> <a href="/tags/xSocket/" style="font-size: 14.62px;">xSocket</a> <a href="/tags/zbus/" style="font-size: 10px;">zbus</a> <a href="/tags/zookeeper/" style="font-size: 10.77px;">zookeeper</a> <a href="/tags/数据结构/" style="font-size: 10.77px;">数据结构</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">January 2016</a><span class="archive-list-count">67</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/12/">December 2015</a><span class="archive-list-count">81</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">November 2015</a><span class="archive-list-count">2</span></li></ul>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2016/01/30/资料/">(no title)</a>
          </li>
        
          <li>
            <a href="/2016/01/30/java/13.Classloader系列一/">ClassLoader系列一</a>
          </li>
        
          <li>
            <a href="/2016/01/29/hadoop/1.hadoop系列之源码编译/">hadoop系列一之源码编译</a>
          </li>
        
          <li>
            <a href="/2016/01/29/go/1.GO系列之入门/">Go系列一之入门</a>
          </li>
        
          <li>
            <a href="/2016/01/28/tomcat/2.tomcat性能优化/">tomcat性能优化</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2016 John Doe<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    


<script src="http://libs.baidu.com/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css" type="text/css">
  <script src="/fancybox/jquery.fancybox.pack.js" type="text/javascript"></script>


<script src="/js/script.js" type="text/javascript"></script>

  </div>
</body>
</html>